<template>
	<view class="addEdit_box">
			<view class="edit_box">
			<!-- <text class="title">炉衬更换记录新增</text> -->
			<form @submit="submit" @reset="formReset">
					<view style="display: inline;">
						<view class="uni-form-item uni-column form_row">
							<label  class="form_row_lable">牌号:</label>
							<input :value="model.ph" name="ph" class="form_row_input" />
						</view>
						
						<view class="uni-form-item uni-column form_row">
							<label  class="form_row_lable">*包内铁水成分标准硅%:</label>
							<input :value="model.cuBz" name="cuBz" class="form_row_input" />
							<!-- <text class="form_row_input">{{model.cuBz}}\n</text> -->
						</view>
						
						
						<view class="uni-form-item uni-column form_row">
							<label class="form_row_lable">*包内铁水成分标准锰%:</label>
							<input :value="model.mnBz" name="mnBz" class="form_row_input"/>
							<!-- <text class="form_row_input">{{model.mnBz}}\n</text> -->
						</view>
						<view class="uni-form-item uni-column form_row" >
							<label  class="form_row_lable">硅粒硅含量%：</label>
							<input :value="model.tlCuhl" name="tlCuhl" class="form_row_input"/>
						</view>
						
						<view class="uni-form-item uni-column form_row">
							<label class="form_row_lable">硅粒硅吸收率%：</label>
							<input :value="model.tlCuxsl" name="tlCuxsl" class="form_row_input"/>
						</view>
						
						<view class="uni-form-item uni-column form_row">
							<label class="form_row_lable">锰铁含锰量%：</label>
							<input :value="model.mtMnhl" name="mtMnhl" class="form_row_input"/>
						</view>
						
						<view class="uni-form-item uni-column form_row">
							<label class="form_row_lable">锰铁锰吸收率%：</label>
							<input :value="model.mtMnxsl" name="mtMnxsl" class="form_row_input"/>
						</view>

						
						<view class="uni-form-item uni-column form_row_btn">
							<button form-type="reset" size="mini" class="reset_btn">清空</button>
							<button form-type="submit" size="mini" class="submit_btn" >提交</button>
						</view>
					</view>
			</form>
		</view>
	</view>
</template>

<script>
	import configService from '@/common/config.service.js';
	const apiUrl = configService.apiUrl;
	export default {
		data() {
			return {
				fromData: {
				},
				model : {// 页面模型对象
				},
			}
		},
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
			const item = JSON.parse(decodeURIComponent(option.item));
			this.model = item;
		},
		methods: {
			submit(e) {
				let _this = this;
				this.fromData = e.detail.value;
				uni.request({
					url: apiUrl + '/bnhjcftzss/edit', 
					data : {...this.model,...this.fromData},
					header: {
						 'Content-Type': 'application/json' //自定义请求头信息
					},
					method:'POST',//请求方式，必须为大写
					success: (res) => {
						let re = res.data;
						if(re.code == 200){
							uni.showToast({
								title: '成功',
								icon:'success',
								duration:1000
							});
							setTimeout(() => {
								//uni.navigateBack()//默认delta:1 方法上一页，优点：地址栏参数还是原先的。
									// uni.navigateBack({
									// 	delta : 2,//返回层数，2则上上页
									// })
								uni.redirectTo({
								    url: '/pages/bzwh/bnhjcftzlist'
								});
							}, 1000)
							
						}else{
							uni.showToast({
								title:'修改失败',
								icon:'error',
								duration:1000
							});
						}
					}
				 })
			},
			formReset(){
			}
		}
	}

</script>
<style scoped lang="scss">
	@import "@/common/addEdit.css";
</style>